#include "guiterm.hpp"
#ifndef TAB_HPP
#define TAB_HPP

class Tab
	:public QWidget
{
	Q_OBJECT
public:
	Tab(Session *session, QWidget *parent=0);
	~Tab();
	
	int getChildMaxHeight() const;
	QScrollBar *getScrollbar();
	TerminalWindow *getWindow();
	void setWindow(TerminalWindow *window);
	Session *getSession();
	string getName();
	string getLabel();
	void setName(string name);
	int getIndex();
	void setIndex(int index);
	
	void close();
	
	void appendSegment(ViewSegment *segment);
	void removeSegment(ViewSegment *segment);
	
	void resizeEvent(QResizeEvent *event);
	
protected slots:
	void segmentHeightChanged(ViewSegment *segment, int newHeight);
	void scrollbarMoved(int value);
	
protected:
	string name;
	int index;
	
	void updateScrollbarPos();
	QScrollBar *scrollbar;
	int scrollbarWidth;

	TerminalFlow *contents;
	
	Session *session;
	TerminalWindow *window;
};

#endif
